package com.dxq.springcloud.controller;
import com.dxq.springcloud.pojo.Dept;
import com.dxq.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class DeptConsumerController {

    @Autowired
    private DeptClientService service = null;

    @PostMapping("/consumer/add/dept")
    public boolean addDept(Dept dept){
        return this.service.addDept(dept);
    }
    @GetMapping("/consumer/dept/get/{id}")
    public Dept getDept(@PathVariable("id") Long id){
        return this.service.queryId(id);
    }
    @GetMapping("/consumer/dept/list")
    public List<Dept> getAllDept(){
        return this.service.queryAll();
    }
}
